﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016080900196319";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCaEb3uFC+jh7H/BQqLBWQrE3ZYk/Y1x6ZM6FIV9zzidxydy68AAe1mG9UNhir6InmeeiGpSNWDBN9jjkOv9MmNFkqvC2iSjZI8DP4CIjEIlls3D0FjzVYawJrPfGxB0ON8wbR+W1+qmUJvH91R7eqIPELY9i0dMiXmOKTLVJzm5vaXbhbPJSqDu59TNcgBa/27LLNQCcAjCCsb/nOKXGe82pNMYHy/IzpR8Tkieh0aFq3EuuzdDF9vu+fyF/WPm+IOVgzr1GmyTNyYfqc4Tw4sUquIY/R0KYO5DD+4wJs/H4hkAhH8Ufd5XoCzSszuJ7PwlgIYARCwOL3yY8Mb6Kd5AgMBAAECggEAA2M6et6kwYK9Ti8tMStYLX5LDt2J/1q5dF1zWJpME2qtDWcqHOTt9F3OTHLTxRY2+F4VGWTJlQzpYIYDRP4r5FdGIx0sGnTUb0+V0jQwQdEUhlxmgqxEJWhwvvksZDIUnmyf7FtT+itOg6T+t8t0abRxf9XB3i95F9vM+8+Ld6Q5emT1wCJ1Ks6iGhX2TF0TJlQpEhvsMweLLNnZsfQhezhzap0Sw35nWJ4BHZEgaqll6+UJO40V2CvmedxxQWc7mWoVA9qm6+RZzscZ44dtZbJnXiocx2mWaFBd8/LTbGgjBTR4Qa4888/NhGWXYVBQHvMFpZn3m+OW0RUXE/aB5QKBgQD4HdwVjHKM/OHqevc5cM5Wt5T9NF0yth9MBr71C6C8Hg1Qf4v2NDcSgyWYx+74Urzu/E7QJAJcNd+jLjSdHK8oHLDr3o46UEvfJaeV/XhztX0XrsHYwQ7E7xU9+jOjL9vIcTzqrLRa6Zb6sEgF7rxoLUPz0NcC+dQ3iWq14KxeGwKBgQCe9uqg9H4nVutPdDar/2fo2iTgKhCx2mPzFnywGG9hHucV15SAwcm4DzjA8MvQEz3tdDi/WZULtTKr2N2jzUOZUXUWDHHtjdYNDzEyhFTASFL9dBt0yfTv1svKFRuPM8MNWE0no7xpNe4EHGVqR2x2Wnqh+caHm+MRN2x/oaNZ+wKBgQCZ9hVqfbNbT1R0pwcf6qLvZo2aLVMjs6VqDMmTzzpXYSKL8AmOpkoCP8Ulr/LWvqikd4YEXEPmqjtyy6o0T+dUsbELPBfvkYHzHy+FwDptOpI8DuIUuX+Lrnv08Hv4aCsujy3oxXBI9agNOTQIEmNxFZ2T/uRc4V/RcoD4CUmMPwKBgAwgG3+RhrnreGGEJNNz1PI/CYcLzmAyn2MgePxZsM1AtTHGUu6LWZ6vko2tEG7buOKO9fEqnSLafHX9QdLHyns8amj3JA2Rvx0Z5o/K5kgQfDwXCi0bZpKQ2NSeTY7bzOoMrT3z0GBaG8C2hcnYjt5sQmRukAUyD9z1VFJb+wDXAoGAEOgSJ6nYS2mnYEcvrmVRng4zxlkQCuDyysJoV4W0TyZUZLsQNDhvoVNrcdwu8b+bUBdkqT/KES8Md4hQVqoRQeGSe46yCG5QocIEk9MjgNKMVYz/zePDxawgUXMK/FU19mqAQCao7X7aPLOJFIMvMQIKnfUHRlbY94u58414wbM=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmhG97hQvo4ex/wUKiwVkKxN2WJP2NcemTOhSFfc84nccncuvAAHtZhvVDYYq+iJ5nnohqUjVgwTfY45Dr/TJjRZKrwtoko2SPAz+AiIxCJZbNw9BY81WGsCaz3xsQdDjfMG0fltfqplCbx/dUe3qiDxC2PYtHTIl5jiky1Sc5ub2l24WzyUqg7ufUzXIAWv9uyyzUAnAIwgrG/5zilxnvNqTTGB8vyM6UfE5InodGhatxLrs3Qxfb7vn8hf1j5viDlYM69RpskzcmH6nOE8OLFKriGP0dCmDuQw/uMCbPx+IZAIR/FH3eV6As0rM7iez8JYCGAEQsDi98mPDG+ineQIDAQAB";
    
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://1910223f8l.iok.la:33254/HotelManagementSystem/alipay_jsp/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://1910223f8l.iok.la:33254/HotelManagementSystem/alipay_jsp/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

